home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / Sources / src / origami / gettoken.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-27  |  38.0 KB  |  1,324 lines

  1. /*{{{}}}*/
  2. /*{{{  #includes*/
  3. #ifdef CONFIG_H
  4. #   include "config.h"
  5. #endif
  6.  
  7. #include <sys/types.h>
  8. #include <ctype.h>
  9. #include <limits.h>
  10. #include <string.h>
  11. #include <signal.h>
  12. #include <stdlib.h>
  13. #include <stdio.h>
  14.  
  15. #define GETTK_C
  16. #define I_BUFFLOOP_C
  17. #define I_LOOP_C
  18. #define I_SET_C
  19. #define I_DISPLAY_C
  20. #define I_FIELDEDIT_C
  21. #define I_FINDS_C
  22. #define I_FOLDING_C
  23. #define I_FOLDFILING_C
  24. #define I_GETMSG_C
  25. #define I_INIT_C
  26. #define I_KEYBOARD_C
  27. #define I_KEYTAB_C
  28. #define I_MAIN_C
  29. #define I_MESSAGES_C
  30. #define I_MISC_C
  31. #define I_ORIEDT_C
  32. #define I_PROMPT_C
  33. #define I_SCREEN_C
  34. #define I_SIGNALS_C
  35. #define I_VIRTUAL_C
  36.  
  37. #include "origami.h"
  38. #include <lib/ori_add_lib.h>
  39. /*}}}  */
  40.  
  41. /*{{{  vars*/
  42. public TOKEN const *macro_pos;
  43. public boolean defining_macro=False;
  44. private boolean prompting=False;
  45. private int argument=0;
  46. private int macro_count;
  47.  
  48. public int bind_const[RCC_SIZE];
  49. public TOKEN const empty_macro[]={M_END_MACRO};
  50. public TOKEN a_f_mac[]={ O_FLUSH,(TOKEN)0,M_END_MACRO };
  51. public macro_entry const *fix_macros=0;
  52. public boolean macro_tag;
  53. public boolean run_abort_mac=False;
  54. public int executing_macro=0;
  55. public int scr_off=0;
  56. public stackent *ocl_var=0;
  57. /*}}}  */
  58.  
  59. /*{{{  OCL stack             push/pop int or adresses for OCL stack*/
  60. /*{{{  variables*/
  61. #define STACK_BLOCK 16
  62.  
  63. private stackent *ocl_stack=0;
  64. private int ocl_stack_size=0;
  65. /*}}}  */
  66.  
  67. /*{{{  check_stack           maybe make stack bigger*/
  68. private boolean check_stack(void)
  69. {
  70.   if (ocl_stack_size-1<=executing_macro)
  71.    /*{{{  expand it*/
  72.    { stackent *ns;
  73.  
  74.      if (!(ns=ori_malloc((ocl_stack_size+STACK_BLOCK)*sizeof(stackent))))
  75.       { msg_message(M_B_NO_MEMORY);
  76.         return(True);
  77.       }
  78.      if (ocl_stack)
  79.       /*{{{  copy and free*/
  80.       { memcpy(ns,ocl_stack,ocl_stack_size*sizeof(stackent));
  81.         paket_free(ocl_stack);
  82.       }
  83.       /*}}}  */
  84.      ocl_stack=ns;
  85.      ocl_stack_size+=STACK_BLOCK;
  86.    }
  87.    /*}}}  */
  88.   return(False);
  89. }
  90. /*}}}  */
  91. /*{{{  push                  push on stack*/
  92. #define push(val) \
  93.    (check_stack()?True:(ocl_stack[executing_macro++]=(val),False))
  94. /*}}}  */
  95. /*{{{  push_el               push typed on stack*/
  96. #define push_el(val,type) \
  97.    (check_stack()?True:(ocl_stack[executing_macro++].type=(val),False))
  98. /*}}}  */
  99. /*{{{  push_tp               push adress*/
  100. #define push_tp(a) push_el((a),tp)
  101. /*}}}  */
  102. /*{{{  push_v                push int*/
  103. #define push_v(val) push_el((val),v)
  104. /*}}}  */
  105. /*{{{  push_l                push line*/
  106. #define push_l(line) push_el((line),l)
  107. /*}}}  */
  108. /*{{{  pop_check             check, if pop can be done*/
  109. #define pop_check()                                                           \
  110.  ( (executing_macro<=0)                                                       \
  111.      ? (exit_origami(r_ocl_err,get_msg(F_INT_OCL,STR_POP_EMPTY_STACK,0)),0)   \
  112.      : 0)
  113. /*}}}  */
  114. /*{{{  pop                   pop from stack*/
  115. #define pop() (pop_check(),ocl_stack[--executing_macro])
  116. /*}}}  */
  117. /*{{{  pop_el                pop typed from stack*/
  118. #define pop_el(type) (pop_check(),ocl_stack[--executing_macro].type)
  119. /*}}}  */
  120. /*{{{  pop_tp                pop adress*/
  121. #define pop_tp() pop_el(tp)
  122. /*}}}  */
  123. /*{{{  pop_v                 pop int*/
  124. #define pop_v() pop_el(v)
  125. /*}}}  */
  126. /*{{{  pop_l                 pop line*/
  127. #define pop_l() pop_el(l)
  128. /*}}}  */
  129. /*}}}  */
  130.  
  131. /*{{{  ori_abort             set tags for signal interrupt*/
  132. public void ori_abort(int sig)
  133. { static int handle=False;
  134.  
  135.   if (!running || handle++)
  136.      return;
  137.   signal(SIGINT, SIG_IGN);
  138.   if (defining_macro)
  139.    { defining_macro=False;
  140.      title_op(CHGTITLE);
  141.    }
  142.   aborted=True;
  143.   if (sig==SIGINT && redraw_on_sig)
  144.      interrupt_restore=True;
  145.   ocl_msg("aborted %d",sig);
  146.   signal(SIGINT, ori_abort);
  147.   handle=0;
  148. }
  149. /*}}}  */
  150. /*{{{  stop_macros           stop macro-execution at correct point*/
  151. public void stop_macros(boolean full)
  152. {
  153.   if (full)
  154.    { int i;
  155.  
  156.      argument=0;
  157.      for (i=1;i<=mac_count;i++)
  158.         unload_demand(i);
  159.    }
  160.   if (!argument)
  161.      disable_abort();
  162.   executing_macro=0;
  163.   macro_pos=fix_macros[0].mac.txt;
  164. }
  165. /*}}}  */
  166. /*{{{  push_macro            push a macro-call on the stack*/
  167. public boolean push_macro(TOKEN const * const to)
  168. {
  169.   ocl_msg("push macro %d",(int)to);
  170.   if (push_tp(macro_pos))
  171.      return(True);
  172.   if (!argument && executing_macro==1)
  173.      enable_abort();
  174.   macro_pos=to;
  175.  
  176.   return(False);
  177. }
  178. /*}}}  */
  179. /*{{{  push_str_macro        create a macro from a string*/
  180. public TOKEN const *push_str_macro(unsigned char const *s)
  181. {
  182.   /*{{{  use 2 buffers, to handle view-macro properly*/
  183.   static TOKEN *dm_buff[2]={ 0,0 };
  184.   static int dm_lg[2]={ 0,0 };
  185.   static int dm_used=0;
  186.   /*}}}  */
  187.   int l;
  188.   TOKEN *t;
  189.  
  190.   dm_used^=1;
  191.   if ((l=ustrlen(s))==0)
  192.      return(empty_macro);
  193.   if (l>=dm_lg[dm_used])
  194.    /*{{{  new macro place*/
  195.    { if (dm_lg[dm_used])
  196.         paket_free(dm_buff[dm_used]);
  197.      dm_lg[dm_used]=
  198.         (dm_buff[dm_used]=ori_malloc((l+3)*sizeof(TOKEN))) ? l : 0;
  199.    }
  200.    /*}}}  */
  201.   if ((t=dm_buff[dm_used]))
  202.    /*{{{  copy string*/
  203.    { if (push_macro(t))
  204.         return(0);
  205.      while ((*t = *s++)) t++;
  206.      /*{{{  append M_ASCII -1, to switch back the used buffer!*/
  207.      *t++=M_ASCII;
  208.      *t++= -1;
  209.      /*}}}  */
  210.      *t++=M_END_MACRO;
  211.    }
  212.    /*}}}  */
  213.  
  214.   return(dm_buff[dm_used]);
  215. }
  216. /*}}}  */
  217. /*{{{  auto_flush            push flush-call on macro-stack*/
  218. public void auto_flush(void)
  219. {
  220.   ocl_msg("auto_flush",0);
  221.   dirty=False;
  222.   push_macro(a_f_mac);
  223. }
  224. /*}}}  */
  225. /*{{{  get_arg               get a int-Argument from macro-buffer*/
  226. public TOKEN get_arg(char const * const s)
  227. {
  228.   if (!executing_macro)
  229.    { ocl_msg("getarg without macro!",0);
  230.      ori_abort(~SIGINT);
  231.      return(0);
  232.    }
  233.   ocl_get_arg_dbg(*macro_pos,s);
  234.  
  235.   return(*macro_pos++);
  236. }
  237. /*}}}  */
  238. /*{{{  get_arg_fixed         get a int-Argument from macro-buffer or opcode*/
  239. public TOKEN get_arg_fixed(int d,char const * const s)
  240. {
  241.   return((d!=-RANGE_ADD)?d:get_arg(s));
  242. }
  243. /*}}}  */
  244. /*{{{  call_number_macro     call macro with given number*/
  245. public void call_number_macro(int mno)
  246. {
  247.   TOKEN const *c;
  248.  
  249.   ocl_msg("call number macro %d",mno);
  250.   if (mno && (c=load_demand(mno)) && c!=empty_macro)
  251.      push_macro(c);
  252. }
  253. /*}}}  */
  254. /*{{{  def_mac_handle        maybe store the given token in the kbdmacro*/
  255. private void def_mac_handle(TOKEN const ch)
  256. {
  257.   if (defining_macro && ch!=O_DEF_MACRO)
  258.    { ((TOKEN*)fix_macros[0].mac.txt)[macro_count]=ch;
  259.      if (macro_count<MAX_MACRO_LENGTH-1)
  260.         macro_count++;
  261.      else
  262.       /*{{{  full*/
  263.       { warn_message(get_msg(M_KEY_BUFF_FULL));
  264.         ((TOKEN*)fix_macros[0].mac.txt)[macro_count]=M_END_MACRO;
  265.         ocl_msg("macro buff full",0);
  266.         ori_abort(~SIGINT);
  267.       }
  268.       /*}}}  */
  269.    }
  270. }
  271. /*}}}  */
  272. /*{{{  prompt_string         generate the correct string from macro*/
  273. public void prompt_string(unsigned char *s)
  274. {
  275.   TOKEN read;
  276.   unsigned char c[2];
  277.   int lg;
  278.  
  279.   for (c[1]='\0',lg=LINELEN;(read=get_arg("string"))!=M_END_MACRO;)
  280.    { unsigned char *x;
  281.  
  282.      /*{{{  get current append string*/
  283.      if (read==M_GET_HISTORY)
  284.       /*{{{  get history x 0*/
  285.          access_history(0,get_arg("string-hist"),False,(int*)0,&x);
  286.       /*}}}  */
  287.      else if (read==M_INT_STRING)
  288.       /*{{{  itoa*/
  289.         x=i_to_ua(ocl_var[get_arg("string-counter")].v);
  290.       /*}}}  */
  291.      else if (read<-MSG_ARG_FORMAT)
  292.       /*{{{  rc_msg*/
  293.         x=rc_msg[-read-MSG_ARG_FORMAT-1];
  294.       /*}}}  */
  295.      else if (read<0)
  296.       /*{{{  msg-msg*/
  297.         x=get_msg
  298.            ( -read,
  299.              empty_text,
  300.              empty_text,
  301.              empty_text,
  302.              empty_text,
  303.              empty_text,
  304.              empty_text
  305.            );
  306.       /*}}}  */
  307.      else
  308.       /*{{{  single char*/
  309.       { c[0]=read;
  310.         x=c;
  311.       }
  312.       /*}}}  */
  313.      /*}}}  */
  314.      /*{{{  copy it*/
  315.      while (lg-->0 && (*s= *x++)) s++;
  316.      /*}}}  */
  317.    }
  318.   *s='\0';
  319. }
  320. /*}}}  */
  321. /*{{{  single_key            get a token*/
  322. /*{{{  forward declaration for internal_hide_key*/
  323. private TOKEN internal_hide_key(boolean);
  324. /*}}}  */
  325.  
  326. private TOKEN single_key(boolean hide)
  327. {
  328.   static TOKEN rep_token=O_NOP;
  329.   static int set_argument= -1;
  330.   TOKEN ch;
  331.  
  332.   do
  333.    { scan_abort_key();
  334.      /*{{{  get next token*/
  335.      if (aborted)
  336.       /*{{{  O_BREAK*/
  337.       { if (executing_macro)
  338.            stop_macros(True);
  339.         ch=O_BREAK;
  340.       }
  341.       /*}}}  */
  342.      else if (executing_macro)
  343.       /*{{{  get from macro-string*/
  344.         ch= *macro_pos++;
  345.       /*}}}  */
  346.      else
  347.       /*{{{  get from keyboard*/
  348.       { if (argument)
  349.          /*{{{  handle repeating*/
  350.          { ch=rep_token;
  351. #          ifdef USE_SCR_BUFF
  352.               if ((argument>ARG_FL_COUNT)&&((argument%ARG_FL_COUNT)==0))
  353.                { ocl_msg("arg-rep auto-flush",0);
  354.                  oflush;
  355.                }
  356. #          endif
  357.            if (!(--argument))
  358.               disable_abort();
  359.          }
  360.          /*}}}  */
  361.         else if (set_argument>=0)
  362.          /*{{{  end repeating*/
  363.          { set_argument= -1;
  364.            disable_abort();
  365.            return(O_PROMPT);
  366.          }
  367.          /*}}}  */
  368.         else
  369.          /*{{{  read from keyboard*/
  370.          { def_mac_handle(ch = get_key()); }
  371.          /*}}}  */
  372.         if (dirty)
  373.            auto_flush();
  374.       }
  375.       /*}}}  */
  376.      ocl_debug(executing_macro,ch);
  377.      /*{{{  M_ASCII*/
  378.      if (ch==M_ASCII)
  379.       { int v;
  380.  
  381.         v=get_arg("insert-ascii");
  382.         if (v>=0)
  383.          /*{{{  use value from ocl-var*/
  384.            ch=ocl_var[v].v;
  385.          /*}}}  */
  386.         else
  387.          /*{{{  use rc-msg*/
  388.          { if
  389.             ( !push_str_macro
  390.                 ( (v==-1)
  391.                     ? (unsigned char*)empty_text
  392.                     : rc_msg[-v-MSG_ARG_FORMAT-1]
  393.                 )
  394.             )
  395.               ori_abort(~SIGINT);
  396.            continue;
  397.          }
  398.          /*}}}  */
  399.       }
  400.      /*}}}  */
  401.      /*}}}  */
  402.      /*{{{  check correct char*/
  403.      if (ch!=O_NOP)
  404.       { chartest;
  405.         if (ch==O_NOP)
  406.          { if (knb_macro)
  407.               call_number_macro(knb_macro);
  408.            if (echo_active)
  409.               msg_message(M_NOT_BOUND);
  410.            return(O_PROMPT);
  411.          }
  412.       }
  413.      /*}}}  */
  414.      if (ch<O_EXE_MACRO && ch>0)
  415.        /*{{{  normal commands*/
  416.        { switch (ch) {
  417.            /*{{{  M_ECHO_I*/
  418.            case M_ECHO_I:
  419.               send_terminal(ocl_var[get_arg("send-term")].v);
  420.               flush_terminal();
  421.               continue;
  422.            /*}}}  */
  423.            /*{{{  M_ECHO_P*/
  424.            case M_ECHO_P:
  425.             { unsigned char prompt[LINELEN+1];
  426.  
  427.               prompt_string(prompt);
  428.               send_s_terminal(prompt);
  429.               flush_terminal();
  430.               continue;
  431.             }
  432.            /*}}}  */
  433.            /*{{{  M_ENV_CMD*/
  434.            case M_ENV_CMD:
  435.             { unsigned char prompt[LINELEN+1];
  436.               int t;
  437.  
  438.               t=get_arg("environ-cmd-type");
  439.               prompt_string(prompt);
  440.               switch(t)
  441.                {
  442.                  /*{{{  test TERM==prompt*/
  443.                  case 0:
  444.                     macro_tag=check_terminal((char*)prompt);
  445.                     break;
  446.                  /*}}}  */
  447.                  /*{{{  getenv*/
  448.                  case 1:
  449.                   { char *e;
  450.  
  451.                     e=getenv((char*)prompt);
  452.                     if (e && *e && !push_str_macro((unsigned char*)e))
  453.                        ori_abort(~SIGINT);
  454.                     break;
  455.                   }
  456.                  /*}}}  */
  457.                }
  458.               break;
  459.             }
  460.            /*}}}  */
  461.            /*{{{  M_FOLD_DATA*/
  462.            case M_FOLD_DATA:
  463.               switch (get_arg("fold-comment-argtype"))
  464.                {
  465.                  /*{{{  0=start-length*/
  466.                  case 0:
  467.                     ocl_var[get_arg("fold-comment-start-length-dest")].v=
  468.                        dialects[bd.m.dialect.typ].lg.start;
  469.                     break;
  470.                  /*}}}  */
  471.                  /*{{{  2=end-length*/
  472.                  case 2:
  473.                     ocl_var[get_arg("fold-comment-end-length-dest")].v=
  474.                        dialects[bd.m.dialect.typ].lg.end;
  475.                     break;
  476.                  /*}}}  */
  477.                  /*{{{  1/3=start/end-data,4/5/6/7=mark-data*/
  478.                  { unsigned char const *s;
  479.  
  480.                    case 1:
  481.                     /*{{{  use start string*/
  482.                       s=dialects[bd.m.dialect.typ].txt.start;
  483.                       goto fold_data_main;
  484.                     /*}}}  */
  485.                    case 3:
  486.                     /*{{{  use end string*/
  487.                       s=dialects[bd.m.dialect.typ].txt.end;
  488.                       goto fold_data_main;
  489.                     /*}}}  */
  490.                    case 4:
  491.                     /*{{{  use fold-begin string*/
  492.                       s=bd.f.str.open_f;
  493.                       goto fold_data_main;
  494.                     /*}}}  */
  495.                    case 5:
  496.                     /*{{{  use fold-end string*/
  497.                       s=bd.f.str.close_f;
  498.                       goto fold_data_main;
  499.                     /*}}}  */
  500.                    case 6:
  501.                     /*{{{  use fold-file string*/
  502.                       s=bd.f.str.file_f;
  503.                       goto fold_data_main;
  504.                     /*}}}  */
  505.                    case 7:
  506.                     /*{{{  use fold-file string*/
  507.                       s=bd.f.str.line_f;
  508.                       goto fold_data_main;
  509.                     /*}}}  */
  510.                    fold_data_main:
  511.                     { int o;
  512.  
  513.                       o=ocl_var[get_arg("fold-comment-xxx offset")].v;
  514.                       push_v((ustrlen(s)>=o && o>=0)?s[o]:0);
  515.                       break;
  516.                     }
  517.                  }
  518.                  /*}}}  */
  519.                  default:
  520.                     break;
  521.                }
  522.               break;
  523.            /*}}}  */
  524.            /*{{{  M_EXIT*/
  525.            case M_EXIT:{
  526.             unsigned char string[LINELEN+1];
  527.  
  528.             prompt_string(string);
  529.             if (string[0])
  530.                message(string);
  531.             stop_macros(False);
  532.             break;
  533.            }
  534.            /*}}}  */
  535.            /*{{{  M_SCREEN_OFF*/
  536.            case M_SCREEN_OFF:
  537.              ocl_screen_off();
  538.              continue;
  539.            /*}}}  */
  540.            /*{{{  M_SCREEN_ON*/
  541.            case M_SCREEN_ON:
  542.              ocl_screen_on();
  543.              if (bd.m.upd_sel_delayed)
  544.                 upd_highlight(bd.f.real_head,bd.f.real_tail,True);
  545.              continue;
  546.            /*}}}  */
  547.            /*{{{  M_LASTMES*/
  548.            case M_LASTMES:
  549.             { if ((macro_tag=((msgtyp)get_arg("last-message")==last_message)))
  550.                  last_message=M_BASE_FORMAT;
  551.               continue;
  552.             }
  553.            /*}}}  */
  554.            /*{{{  M_GET_BUFFER*/
  555.            case M_GET_BUFFER:
  556.             { int x;
  557.               int y;
  558.  
  559.               x=ocl_var[get_arg("get-buffer-x")].v;
  560.               y=ocl_var[get_arg("get-buffer-y")].v;
  561.               push_v(decode_buffer_mouse(x,y,False));
  562.               break;
  563.             }
  564.            /*}}}  */
  565.            /*{{{  M_GET_HISTORY*/
  566.            case M_GET_HISTORY:
  567.             { unsigned char *s;
  568.               histories old_default;
  569.               int off;
  570.  
  571.               old_default=overwrite_history_id;
  572.               overwrite_history_id=(histories)get_arg("get-history");
  573.               off=ocl_var[get_arg("get-h-offset")].v;
  574.               access_history(off,overwrite_history_id,False,(int*)0,&s);
  575.               overwrite_history_id=old_default;
  576.               if (!push_str_macro(s))
  577.                  ori_abort(~SIGINT);
  578.               continue;
  579.             }
  580.            /*}}}  */
  581.            /*{{{  M_LOAD_MAC*/
  582.            case M_LOAD_MAC:
  583.             { boolean in;
  584.               int no;
  585.  
  586.               in=get_arg("load type")!=0;
  587.               no=get_arg("unload arg");
  588.               no=((no<0)?-no:ocl_var[no].v)-O_EXE_MACRO;
  589.               if (in)
  590.                  load_demand(no);
  591.               else
  592.                  unload_demand(no);
  593.               continue;
  594.             }
  595.            /*}}}  */
  596.            /*{{{  M_STORE_LINE_NO*/
  597.            case M_STORE_LINE_NO:
  598.             { int ind=get_arg("store-line-target");
  599.  
  600.               ocl_var[ind].v=bd.f.current?cur_line_no():0;
  601.               continue;
  602.             }
  603.            /*}}}  */
  604.            /*{{{  M_STORE_MARK*/
  605.            case M_STORE_MARK:
  606.             { int ind=get_arg("store-line-mark-target");
  607.  
  608.               ocl_var[ind].l=bd.f.current;
  609.               continue;
  610.             }
  611.            /*}}}  */
  612.            /*{{{  M_END_MACRO*/
  613.            case M_END_MACRO:
  614.               macro_pos=pop_tp();
  615.               if (!executing_macro && !argument)
  616.                { disable_abort();
  617.                  run_abort_mac=False;
  618.                }
  619.               if (!executing_macro && !hide)
  620.                  return(O_PROMPT);
  621.               continue;
  622.            /*}}}  */
  623.            /*{{{  M_SET_COPY*/
  624.            case M_SET_COPY:
  625.             { int to=get_arg("set-copy-to");
  626.               int from=get_arg("set-copy-from");
  627.  
  628.               set_copy(to,from);
  629.               continue;
  630.             }
  631.            /*}}}  */
  632.            /*{{{  M_SHOW_CURSOR*/
  633.            case M_SHOW_CURSOR:
  634.               restore_cursor_and_sleep(ocl_var[get_arg("delay")].v);
  635.               continue;
  636.            /*}}}  */
  637.            /*{{{  M_EDITING*/
  638.            case M_EDITING: {
  639.              macro_tag=prompting;
  640.              continue;
  641.            }
  642.            /*}}}  */
  643.            /*{{{  M_CALL*/
  644.            CASES_M_CALL
  645.            case M_CALL: {
  646.              int offset=get_arg_fixed(ch-M_CALL_0,"adress");
  647.  
  648.              if (push_macro(macro_pos+offset))
  649.                 break;
  650.              continue;
  651.            }
  652.            /*}}}  */
  653.            /*{{{  M_CHANGED*/
  654.            case M_CHANGED: {
  655.              macro_tag=(bd.m.file_changed_status!=unchanged_file);
  656.              continue;
  657.            }
  658.            /*}}}  */
  659.            /*{{{  M_FILETYP*/
  660.            case M_FILETYP: {
  661.              ocl_var[get_arg("FILE-target")].v=
  662.                                    !bd.m.dir_edit             ?  0 :
  663.                                   *(get_data(bd.f.real_tail)) ?  1 :
  664.                                                                 -1 ;
  665.              continue;
  666.            }
  667.            /*}}}  */
  668.            /*{{{  M_TEST_HASH*/
  669.            case M_TEST_HASH: {
  670.              macro_tag=bd.m.hash_shift;
  671.              continue;
  672.            }
  673.            /*}}}  */
  674.            /*{{{  M_TEST_OVER*/
  675.            case M_TEST_OVER: {
  676.              macro_tag=bd.m.overwrite;
  677.              continue;
  678.            }
  679.            /*}}}  */
  680.            /*{{{  M_TEST_AUTO*/
  681.            case M_TEST_AUTO: {
  682.              macro_tag=auto_save;
  683.              continue;
  684.            }
  685.            /*}}}  */
  686.            /*{{{  M_TEST_VERBOSE*/
  687.            case M_TEST_VERBOSE:
  688.               macro_tag=verbose;
  689.               continue;
  690.            /*}}}  */
  691.            /*{{{  M_TEST_VIEW*/
  692.            case M_TEST_VIEW: {
  693.              macro_tag=bd.m.read_only;
  694.              continue;
  695.            }
  696.            /*}}}  */
  697.            /*{{{  M_TEST_ECHO*/
  698.            case M_TEST_ECHO: {
  699.              macro_tag=echo_active;
  700.              continue;
  701.            }
  702.            /*}}}  */
  703.            /*{{{  M_HISTORY*/
  704.            case M_HISTORY:
  705.                overwrite_history_id=(histories)get_arg("switch-history");
  706.                continue;
  707.            /*}}}  */
  708.            /*{{{  O_UNCHANGE*/
  709.            case O_UNCHANGE:
  710.               if (bd.m.file_changed_status!=unchanged_file)
  711.                { bd.m.file_changed_status=unchanged_file;
  712.                  title_op(CHGTITLE);
  713.                }
  714.               no_message();
  715.               break;
  716.            /*}}}  */
  717.            /*{{{  M_JMP*/
  718.            CASES_M_JMP
  719.            case M_JMP: {
  720.              int diff;
  721.  
  722.              diff=get_arg_fixed(ch-M_JMP_0,"jmp-offset");
  723.              macro_pos+=diff;
  724.              continue;
  725.            }
  726.            /*}}}  */
  727.            /*{{{  M_JMP_FALSE*/
  728.            CASES_M_JMP_FALSE
  729.            case M_JMP_FALSE: {
  730.              int diff;
  731.  
  732.              diff=get_arg_fixed(ch-M_JMP_FALSE_0,"jpf-offset");
  733.              if (!macro_tag) macro_pos+=diff;
  734.              continue;
  735.            }
  736.            /*}}}  */
  737.            /*{{{  M_JMP_TRUE*/
  738.            CASES_M_JMP_TRUE
  739.            case M_JMP_TRUE:
  740.             { int diff;
  741.  
  742.               diff=get_arg_fixed(ch-M_JMP_TRUE_0,"jpt-offset");
  743.               if (macro_tag)
  744.                  macro_pos+=diff;
  745.               continue;
  746.             }
  747.            /*}}}  */
  748.            /*{{{  M_NOT*/
  749.            case M_NOT: {
  750.              macro_tag=!macro_tag;
  751.              continue;
  752.            }
  753.            /*}}}  */
  754.            /*{{{  M_LANGUAGE*/
  755.            case M_LANGUAGE:
  756.               macro_tag=(dialects[bd.m.dialect.typ].name[0]==get_arg("language"));
  757.               continue;
  758.            /*}}}  */
  759.            /*{{{  M_TEXTLINE*/
  760.            case M_TEXTLINE:
  761.               ori_assert(bd.f.cur_line_typ==get_linetyp(*bd.f.current),"check cur_linetyp");
  762.               macro_tag=(boolean)(bd.f.cur_line_typ&NOT_FOLD);
  763.               continue;
  764.            /*}}}  */
  765.            /*{{{  M_TEST_FOLD*/
  766.            case M_TEST_FOLD:
  767.               macro_tag=bd.m.select_mode!=no_selection;
  768.               ocl_var[var_ocl_arg].v=bd.m.select_mode-1;
  769.               continue;
  770.            /*}}}  */
  771.            /*{{{  M_BEGIN_FOLD_COMMENT*/
  772.            case M_BEGIN_FOLD_COMMENT:
  773.               ori_assert(bd.f.cur_line_typ==get_linetyp(*bd.f.current),"check cur_linetyp");
  774.               macro_tag=(boolean)(bd.f.cur_line_typ&START_OPEN_FOLD);
  775.               continue;
  776.            /*}}}  */
  777.            /*{{{  M_CLOSED_FOLD*/
  778.            case M_CLOSED_FOLD:
  779.               ori_assert(bd.f.cur_line_typ==get_linetyp(*bd.f.current),"check cur_linetyp");
  780.               macro_tag=(boolean)(bd.f.cur_line_typ&START_FOLD);
  781.               continue;
  782.            /*}}}  */
  783.            /*{{{  M_END_FOLD_COMMENT*/
  784.            case M_END_FOLD_COMMENT:
  785.               ori_assert(bd.f.cur_line_typ==get_linetyp(*bd.f.current),"check cur_linetyp");
  786.               macro_tag=(boolean)(bd.f.cur_line_typ&END_FOLD);
  787.               continue;
  788.            /*}}}  */
  789.            /*{{{  M_FILED_FOLD*/
  790.            case M_FILED_FOLD:
  791.               ori_assert(bd.f.cur_line_typ==get_linetyp(*bd.f.current),"check cur_linetyp");
  792.               macro_tag=(boolean)(bd.f.cur_line_typ&START_FILED);
  793.               continue;
  794.            /*}}}  */
  795.            /*{{{  M_SET_COUNTER*/
  796.            CASES_M_SET_COUNTER
  797.            case M_SET_COUNTER: {
  798.              int x=get_arg("set-target");
  799.  
  800.              ocl_var[x].v=get_arg_fixed(ch-M_SET_COUNTER_0,"set-source");
  801.              continue;
  802.            }
  803.            /*}}}  */
  804.            /*{{{  M_ENTERED*/
  805.            case M_ENTERED:
  806.              ocl_var[get_arg("entered-target")].v=bd.f.entered;
  807.              continue;
  808.            /*}}}  */
  809.            /*{{{  M_S_ENTERED*/
  810.            case M_S_ENTERED:
  811.              ocl_var[get_arg("space-entered-target")].v=bd.f.enter_spaces;
  812.              continue;
  813.            /*}}}  */
  814.            /*{{{  M_INT_STRING*/
  815.            case M_INT_STRING:
  816.               if (!push_str_macro(i_to_ua(ocl_var[get_arg("int-source")].v)))
  817.                  ori_abort(~SIGINT);
  818.              continue;
  819.            /*}}}  */
  820.            /*{{{  M_READ_REPEAT*/
  821.            case M_READ_REPEAT: {
  822.              ocl_var[get_arg("read-repeat")].v=set_argument;
  823.              set_argument= -1;
  824.              argument=0;
  825.              continue;
  826.            }
  827.            /*}}}  */
  828.            /*{{{  M_NULL_COUNTER*/
  829.            case M_NULL_COUNTER:
  830.               macro_tag=(ocl_var[get_arg("=0")].v==0);
  831.               continue;
  832.            /*}}}  */
  833.            /*{{{  M_MENU*/
  834.            case M_MENU: {
  835.              int *x= &((ocl_var+get_arg("menu-target"))->v);
  836.              unsigned char prompt[LINELEN+1];
  837.  
  838.              prompt_string(prompt);
  839.              *x=menu_item(prompt,*x,True,True);
  840.              no_message();
  841.              continue;
  842.            }
  843.            /*}}}  */
  844.            /*{{{  M_PROMPTs*/
  845.            case M_PROMPT_C:
  846.            case M_PROMPT: {
  847.              int counter=get_arg("prompt-target");
  848.              unsigned char string[LINELEN+1];
  849.              unsigned char *s=string;
  850.              unsigned char *d;
  851.              TOKEN x=O_NOP;
  852.  
  853.              if (!prompting)
  854.               { ori_assert(bd.scr.cur_shift_w<=LINELEN,"shift-check");
  855.                 title_op(UPDTITLE);
  856.               }
  857.              prompt_string(string);
  858.              if (counter==-3)
  859.               /*{{{  paste message to text*/
  860.               { if (string[0])
  861.                  { push_str_macro(string);
  862.                    ch = *macro_pos++;
  863.                    if (ch==M_END_MACRO)
  864.                     { macro_pos--;
  865.                       continue;
  866.                     }
  867.                  }
  868.                 else
  869.                    ch=O_NOP;
  870.                 return(ch);
  871.               }
  872.               /*}}}  */
  873.              else if (counter==-2)
  874.               /*{{{  simply show*/
  875.                 if (ocl_var[var_mod_beh].v)
  876.                  { if (verbose)
  877.                       message(string);
  878.                  }
  879.                 else
  880.                    message(string);
  881.               /*}}}  */
  882.              else
  883.               /*{{{  show and wait for input*/
  884.               { while (*s++);
  885.                 d = --s;
  886.                 /*{{{  read the string direct from keyboard*/
  887.                 disable_abort();
  888.                 enable_echo(False);
  889.                 /* if aborted is true before get_key is called, then ... :-( */
  890.                 if (string[0] || ch==M_PROMPT)
  891.                    message(string);
  892.                 *s=0;
  893.                 while (!aborted && (x=get_key())!=O_RETURN)
  894.                  { if (ch==M_PROMPT_C)
  895.                       break;
  896.                    if (   x<O_NOP
  897.                        && (   isalnum((char) x)
  898.                            || ((char) x =='-')
  899.                           )
  900.                       )
  901.                       *s++ = (char) x;
  902.                    else if ((x==O_DELETE) && s!=d)
  903.                       --s;
  904.                    *s='\0';
  905.                    message(string);
  906.                  }
  907.                 enable_echo(True);
  908.                 enable_abort();
  909.                 /*}}}  */
  910.                 if (!aborted)
  911.                    if (counter>=0)
  912.                      if (ch==M_PROMPT_C)
  913.                        ocl_var[counter].v=x;
  914.                      else {
  915.                        *d=toupper(*d);
  916.                        if (*d==YES)
  917.                          ocl_var[counter].v=1;
  918.                        else if (*d==NO)
  919.                          ocl_var[counter].v=0;
  920.                        else
  921.                          ocl_var[counter].v=atoi((char *)d);
  922.                      }
  923.               }
  924.               /*}}}  */
  925.              continue;
  926.            }
  927.            /*}}}  */
  928.            /*{{{  M_PUSH_INT*/
  929.            case M_PUSH_INT:
  930.               if (push(ocl_var[get_arg("push")])) goto push_stack_crash;
  931.               continue;
  932.            /*}}}  */
  933.            /*{{{  M_POP_DELBUFF*/
  934.            case M_POP_DELBUF:
  935.               if (deleted_lines[delete_ptr])
  936.                { proc_dispose(deleted_lines[delete_ptr]);
  937.                  deleted_lines[delete_ptr]=0;
  938.                }
  939.               if (--delete_ptr<0)
  940.                  delete_ptr=UNDEL_LINES-1;
  941.               continue;
  942.            /*}}}  */
  943.            /*{{{  M_POP_INT*/
  944.            case M_POP_INT:
  945.               ocl_var[get_arg("pop")]=pop();
  946.               continue;
  947.            /*}}}  */
  948.            /*{{{  M_PUSH/POP_INT_X*/
  949.            case M_PUSH_INT_X:
  950.            case M_POP_INT_X:
  951.             { int a1,a2,o;
  952.  
  953.               a1=get_arg("push/pop-array");
  954.               a2=get_arg("push/pop-offset");
  955.               o=a1+ocl_var[a2].v;
  956.               if (o<0 || o>=var_count)
  957.                { index_crash:
  958.                  ocl_msg("invalid var adress",0);
  959.                  ori_abort(~SIGINT);
  960.                  warn_message(get_msg(F_INT_OCL,STR_INV_VAR,o));
  961.                }
  962.               else if (ch==M_POP_INT_X)
  963.                  ocl_var[o]=pop();
  964.               else if (push(ocl_var[o]))
  965.                { push_stack_crash:
  966.                  ori_abort(~SIGINT);
  967.                  warn_message(get_msg(M_STACK_OVER));
  968.                  break;
  969.                }
  970.               continue;
  971.             }
  972.            /*}}}  */
  973.            /*{{{  M_POSITIV_COUNTER*/
  974.            case M_POSITIV_COUNTER:
  975.               macro_tag=(ocl_var[get_arg(">0")].v>0);
  976.               continue;
  977.            /*}}}  */
  978.            /*{{{  M_ADD_COUNTER*/
  979.            CASES_M_ADD_COUNTER
  980.            case M_ADD_COUNTER:
  981.             { int x=get_arg("add-target");
  982.  
  983.               macro_tag=((ocl_var[x].v+=get_arg_fixed(ch-M_ADD_COUNTER_0,"add-source"))==0);
  984.               continue;
  985.             }
  986.            /*}}}  */
  987.            /*{{{  M_INV_COUNTER*/
  988.            case M_INV_COUNTER:
  989.             { int x=get_arg("inv");
  990.  
  991.               macro_tag=((ocl_var[x].v= -ocl_var[x].v)==0);
  992.               continue;
  993.             }
  994.            /*}}}  */
  995.            /*{{{  M_SET_USER_MODE_NUMB*/
  996.            case M_SET_USER_MODE_NUMB:
  997.             { int i=get_arg("set-user-numb");
  998.             
  999.               n_modes[i]=ocl_var[get_arg("set-user-val")].v;
  1000.               um_active[i]=True;
  1001.               title_op(CHGTITLE);
  1002.               no_message();
  1003.               continue;
  1004.             }
  1005.            /*}}}  */
  1006.            /*{{{  M_(RE)SET_USER_MODE*/
  1007.            case M_RESET_USER_MODE:
  1008.            case M_SET_USER_MODE:
  1009.             { int i=get_arg("set-user");
  1010.             
  1011.               n_modes[i]=0;
  1012.               if (um_active[i]!=(ch==M_SET_USER_MODE))
  1013.                { um_active[i]=(ch==M_SET_USER_MODE);
  1014.                  title_op(CHGTITLE);
  1015.                }
  1016.               no_message();
  1017.               continue;
  1018.             }
  1019.            /*}}}  */
  1020.            /*{{{  M_SUM_COUNTER*/
  1021.            case M_SUM_COUNTER:
  1022.             { int x=get_arg("sum-target");
  1023.  
  1024.               macro_tag=((ocl_var[x].v+=ocl_var[get_arg("sum-source")].v)==0);
  1025.               continue;
  1026.             }
  1027.            /*}}}  */
  1028.            /*{{{  M_MULT*/
  1029.            case M_MULT:
  1030.             { int x=get_arg("mult-target");
  1031.             
  1032.               ocl_var[x].v *= ocl_var[get_arg("mult-source")].v;
  1033.               continue;
  1034.             }
  1035.            /*}}}  */
  1036.            /*{{{  M_MOD*/
  1037.            case M_MOD:
  1038.             { int x=get_arg("mod-target");
  1039.               int y=ocl_var[get_arg("mod-source")].v;
  1040.             
  1041.               if (y)
  1042.                  ocl_var[x].v %= y;
  1043.               else
  1044.                { ocl_msg("%d%%0",ocl_var[x].v);
  1045.                  ori_abort(~SIGINT);
  1046.                }
  1047.               continue;
  1048.             }
  1049.            /*}}}  */
  1050.            /*{{{  M_DIV*/
  1051.            case M_DIV:
  1052.             { int x=get_arg("div-target");
  1053.               int y=ocl_var[get_arg("div-source")].v;
  1054.             
  1055.               if (y)
  1056.                  ocl_var[x].v /= y;
  1057.               else
  1058.                { ocl_msg("%d/0",ocl_var[x].v);
  1059.                  ori_abort(~SIGINT);
  1060.                }
  1061.               continue;
  1062.             }
  1063.            /*}}}  */
  1064.            /*{{{  O_UNDEL_CHAR*/
  1065.            case O_UNDEL_CHAR:
  1066.               return(deleted_ch);
  1067.            /*}}}  */
  1068.            /*{{{  O_BELL*/
  1069.            case O_BELL:
  1070.               bell_audible();
  1071.               break;
  1072.            /*}}}  */
  1073.            /*{{{  O_BELL_VISIBLE*/
  1074.            case O_BELL_VISIBLE:
  1075.               bell_visible();
  1076.               break;
  1077.            /*}}}  */
  1078.            /*{{{  M_SW_KBD*/
  1079.            case M_SW_KBD:
  1080.               kbd_change(get_arg("kbd"));
  1081.               continue;
  1082.            /*}}}  */
  1083.            /*{{{  O_DEF_MACRO*/
  1084.            case O_DEF_MACRO:
  1085.               if (!hide) {
  1086.                 defining_macro = !defining_macro;
  1087.                 if (defining_macro)
  1088.                    macro_count=0;
  1089.                 ((TOKEN*)fix_macros[0].mac.txt)[macro_count]=M_END_MACRO;
  1090.                 no_message();
  1091.                 title_op(CHGTITLE);
  1092.               }
  1093.               break;
  1094.            /*}}}  */
  1095.            /*{{{  O_DEF_FIX*/
  1096.            case O_DEF_FIX:
  1097.               if (!hide) {
  1098.                 TOKEN const *mac;
  1099.                 unsigned char temp[LINELEN+1];
  1100.                 int x;
  1101.  
  1102.                 /*{{{  testing error-cases*/
  1103.                 if (defining_macro)
  1104.                  { warn_message(get_msg(M_FIX_EXE));
  1105.                    ocl_msg("def and copy mac",0);
  1106.                    ori_abort(~SIGINT);
  1107.                    break;
  1108.                  }
  1109.                 /*}}}  */
  1110.                 s_readprompt(temp,get_msg(M_WHICH_FIX),20,no_history);
  1111.                 if (aborted) break;
  1112.                 x=atoi((char *)temp);
  1113.                 if (x<1 || x>mac_count || fix_macros[x].mode!=init)
  1114.                  { warn_message(get_msg(F_NO_DEFINE));
  1115.                    break;
  1116.                  }
  1117.                 if (fix_macros[x].mac.txt!=empty_macro)
  1118.                  { paket_free((TOKEN*)fix_macros[x].mac.txt);
  1119.                    ((macro_entry*)fix_macros)[x].mac.txt=empty_macro;
  1120.                  }
  1121.                 if (!(mac=ori_malloc((macro_count+1)*sizeof(TOKEN))))
  1122.                  { warn_message(get_msg(M_B_NO_MEMORY));
  1123.                    break;
  1124.                  }
  1125.                 no_message();
  1126.                 memcpy
  1127.                  ( (TOKEN*)(((macro_entry*)fix_macros)[x].mac.txt=mac),
  1128.                    fix_macros[0].mac.txt,
  1129.                    (macro_count+1)*sizeof(TOKEN)
  1130.                  );
  1131.               }
  1132.               break;
  1133.            /*}}}  */
  1134.            /*{{{  O_NOP*/
  1135.            case O_NOP:
  1136.               if (echo_active) no_message();
  1137.               continue;
  1138.            /*}}}  */
  1139.            /*{{{  handle O_REP_DEF*/
  1140.            case O_REP_0:
  1141.            case O_REP_1:
  1142.            case O_REP_2:
  1143.            case O_REP_3:
  1144.            case O_REP_4:
  1145.            case O_REP_5:
  1146.            case O_REP_6:
  1147.            case O_REP_7:
  1148.            case O_REP_8:
  1149.            case O_REP_9:
  1150.               if (set_argument<0)
  1151.                /*{{{  do it*/
  1152.                { if (defining_macro || executing_macro)
  1153.                   /*{{{  error: conflict define-macro and repeating!*/
  1154.                   { ocl_msg("rep and def mac",0);
  1155.                     ori_abort(~SIGINT);
  1156.                     continue;
  1157.                   }
  1158.                   /*}}}  */
  1159.                  /*{{{  get number and next token*/
  1160.                  { int x;
  1161.                    unsigned char prom[LINELEN+1];
  1162.                    unsigned char *s;
  1163.  
  1164.                    /*{{{  prepare internal data*/
  1165.                    ustrcpy(prom,get_msg(M_ARG));
  1166.                    s=prom+ustrlen(prom);
  1167.                    x=ch-O_REP_0;
  1168.                    set_argument=0;
  1169.                    /*}}}  */
  1170.                    /*{{{  get integer and the following token*/
  1171.                    for (;;)
  1172.                     { set_argument=10*set_argument+x;
  1173.                       *s++=hex_digits[x];
  1174.                       *s='\0';
  1175.                       message(prom);
  1176.                       ch=internal_hide_key(True);
  1177.                       x=0;
  1178.                       if (!quote_used)
  1179.                          switch(ch)
  1180.                           { case '9':case O_REP_9:x++;
  1181.                             case '8':case O_REP_8:x++;
  1182.                             case '7':case O_REP_7:x++;
  1183.                             case '6':case O_REP_6:x++;
  1184.                             case '5':case O_REP_5:x++;
  1185.                             case '4':case O_REP_4:x++;
  1186.                             case '3':case O_REP_3:x++;
  1187.                             case '2':case O_REP_2:x++;
  1188.                             case '1':case O_REP_1:x++;
  1189.                             case '0':case O_REP_0:continue;
  1190.                             default:              break;
  1191.                           }
  1192.                       break;
  1193.                     }
  1194.                    /*}}}  */
  1195.                  }
  1196.                  /*}}}  */
  1197.                  if (ch==O_BREAK || aborted)
  1198.                   /*{{{  ready*/
  1199.                   { set_argument= -1;
  1200.                     argument=0;
  1201.                     break;
  1202.                   }
  1203.                   /*}}}  */
  1204.                  else
  1205.                   /*{{{  start the repeating*/
  1206.                   { argument=set_argument;
  1207.                     rep_token=ch;
  1208.                     if (!argument) argument=1;
  1209.                     enable_abort();
  1210.                     continue;
  1211.                   }
  1212.                   /*}}}  */
  1213.                }
  1214.                /*}}}  */
  1215.               else
  1216.                  continue;
  1217.            /*}}}  */
  1218.            /*{{{  default: return the value*/
  1219.            default:
  1220.               return(ch);
  1221.            /*}}}  */
  1222.          }
  1223.        }
  1224.        /*}}}  */
  1225.      else if (ch<=(O_EXE_MACRO+mac_count) && ch>=O_EXE_MACRO)
  1226.       /*{{{  execute macros*/
  1227.       { TOKEN const *c;
  1228.         int number=ch-O_EXE_MACRO;
  1229.  
  1230.         if (ch==O_EXE_MACRO)
  1231.          /*{{{  some test for keyboard macro*/
  1232.          { if (defining_macro)
  1233.             { warn_message(get_msg(M_EXE_EXE));
  1234.               ocl_msg("def and exec kbd mac",0);
  1235.               ori_abort(~SIGINT);
  1236.               continue;
  1237.             }
  1238.            if (macro_count==0)
  1239.             { ch=O_NOP;
  1240.               break;
  1241.             }
  1242.          }
  1243.          /*}}}  */
  1244.         if (!(c=load_demand(number)))
  1245.          { ocl_msg("demand error",0);
  1246.            ori_abort(~SIGINT);
  1247.          }
  1248.         else if (push_macro(c)||hide)
  1249.          { ch=O_BREAK;
  1250.            break;
  1251.          }
  1252.         continue;
  1253.       }
  1254.       /*}}}  */
  1255.      else
  1256.         exit_origami(r_ocl_err,get_msg(F_INT_OCL,STR_INV_TOK,ch));
  1257.      ch=O_PROMPT;
  1258.      break;
  1259.    }
  1260.   while (!hide);
  1261.   return ch;
  1262. }
  1263. /*}}}  */
  1264. /*{{{  internal_hide_key     get a token direct from keyboard, store it to mac*/
  1265. private TOKEN internal_hide_key(boolean direct)
  1266. { boolean oldprompt=prompting;
  1267.   boolean pr_tag;
  1268.   TOKEN x;
  1269.  
  1270.   enable_echo(False);
  1271.   prompting=True;
  1272.   pr_tag=macro_tag;
  1273.   if (pin_macro)
  1274.    /*{{{  call prompt-in*/
  1275.    { int old_exe_mac;
  1276.  
  1277.      old_exe_mac=executing_macro;
  1278.      call_number_macro(pin_macro);
  1279.      do
  1280.         single_key(True);
  1281.      while (old_exe_mac<executing_macro);
  1282.    }
  1283.    /*}}}  */
  1284.   macro_tag=pr_tag;
  1285.   /*{{{  get input-character*/
  1286.   if (direct)
  1287.      def_mac_handle(x=get_key());
  1288.   else
  1289.      do
  1290.         x=single_key(False);
  1291.      while (x==O_PROMPT || invalid_prompt_key(x));
  1292.   /*}}}  */
  1293.   pr_tag=macro_tag;
  1294.   if (pout_macro)
  1295.    /*{{{  call prompt-out*/
  1296.    { int old_exe_mac;
  1297.  
  1298.      old_exe_mac=executing_macro;
  1299.      call_number_macro(pout_macro);
  1300.      do
  1301.         single_key(True);
  1302.      while (old_exe_mac<executing_macro);
  1303.    }
  1304.    /*}}}  */
  1305.   macro_tag=pr_tag;
  1306.   prompting=oldprompt;
  1307.   enable_echo(True);
  1308.  
  1309.   return(x);
  1310. }
  1311. /*}}}  */
  1312. /*{{{  hide_key              get a token. mode is in-prompt*/
  1313. public TOKEN hide_key(void)
  1314. {
  1315.   return(internal_hide_key(False));
  1316. }
  1317. /*}}}  */
  1318. /*{{{  edit_key              get a token and set *keypad, mode is editing*/
  1319. public TOKEN edit_key(void)
  1320. {
  1321.   return(single_key(False));
  1322. }
  1323. /*}}}  */
  1324.